summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNarr the Reg <juangerman-13@hotmail.com>2024-01-15 04:04:02 +0100
committergerman77 <juangerman-13@hotmail.com>2024-01-16 06:17:03 +0100
commit7f5adf8982e12b0629b6c3a90b2b783209ef09cc (patch)
tree3d93f74edd8d3a23311e8b240c4e26cfb26a2b17
parentservice: set: Refractor setting service (diff)
downloadyuzu-7f5adf8982e12b0629b6c3a90b2b783209ef09cc.tar
yuzu-7f5adf8982e12b0629b6c3a90b2b783209ef09cc.tar.gz
yuzu-7f5adf8982e12b0629b6c3a90b2b783209ef09cc.tar.bz2
yuzu-7f5adf8982e12b0629b6c3a90b2b783209ef09cc.tar.lz
yuzu-7f5adf8982e12b0629b6c3a90b2b783209ef09cc.tar.xz
yuzu-7f5adf8982e12b0629b6c3a90b2b783209ef09cc.tar.zst
yuzu-7f5adf8982e12b0629b6c3a90b2b783209ef09cc.zip
-rw-r--r--src/core/hle/service/hid/hid.cpp2
-rw-r--r--src/core/hle/service/set/setting_formats/appln_settings.cpp6
-rw-r--r--src/core/hle/service/set/setting_formats/system_settings.cpp6
-rw-r--r--src/core/hle/service/set/settings_types.h2
-rw-r--r--src/core/hle/service/set/system_settings_server.cpp213
-rw-r--r--src/core/hle/service/set/system_settings_server.h20
-rw-r--r--src/hid_core/resources/hid_firmware_settings.cpp35
-rw-r--r--src/hid_core/resources/hid_firmware_settings.h12
8 files changed, 232 insertions, 64 deletions
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp
index 4ce0a9834..03ebdc137 100644
--- a/src/core/hle/service/hid/hid.cpp
+++ b/src/core/hle/service/hid/hid.cpp
@@ -20,7 +20,7 @@ void LoopProcess(Core::System& system) {
auto server_manager = std::make_unique<ServerManager>(system);
std::shared_ptr<ResourceManager> resource_manager = std::make_shared<ResourceManager>(system);
std::shared_ptr<HidFirmwareSettings> firmware_settings =
- std::make_shared<HidFirmwareSettings>();
+ std::make_shared<HidFirmwareSettings>(system);
// TODO: Remove this hack when am is emulated properly.
resource_manager->Initialize();
diff --git a/src/core/hle/service/set/setting_formats/appln_settings.cpp b/src/core/hle/service/set/setting_formats/appln_settings.cpp
index 566ee1b13..f7c7d5b91 100644
--- a/src/core/hle/service/set/setting_formats/appln_settings.cpp
+++ b/src/core/hle/service/set/setting_formats/appln_settings.cpp
@@ -6,7 +6,11 @@
namespace Service::Set {
ApplnSettings DefaultApplnSettings() {
- return {};
+ ApplnSettings settings{};
+
+ settings.mii_author_id = Common::UUID::MakeDefault();
+
+ return settings;
}
} // namespace Service::Set
diff --git a/src/core/hle/service/set/setting_formats/system_settings.cpp b/src/core/hle/service/set/setting_formats/system_settings.cpp
index 4e524c0de..66e57651e 100644
--- a/src/core/hle/service/set/setting_formats/system_settings.cpp
+++ b/src/core/hle/service/set/setting_formats/system_settings.cpp
@@ -11,6 +11,8 @@ SystemSettings DefaultSystemSettings() {
settings.version = 0x140000;
settings.flags = 7;
+ settings.mii_author_id = Common::UUID::MakeDefault();
+
settings.color_set_id = ColorSet::BasicWhite;
settings.notification_settings = {
@@ -45,6 +47,10 @@ SystemSettings DefaultSystemSettings() {
settings.device_time_zone_location_name = {"UTC"};
settings.user_system_clock_automatic_correction_enabled = false;
+ settings.primary_album_storage = PrimaryAlbumStorage::SdCard;
+ settings.battery_percentage_flag = true;
+ settings.chinese_traditional_input_method = ChineseTraditionalInputMethod::Unknown0;
+
return settings;
}
diff --git a/src/core/hle/service/set/settings_types.h b/src/core/hle/service/set/settings_types.h
index ae2a884bc..4dee202d7 100644
--- a/src/core/hle/service/set/settings_types.h
+++ b/src/core/hle/service/set/settings_types.h
@@ -342,7 +342,7 @@ struct UserSelectorFlag {
u32 raw{};
BitField<0, 1, u32> SkipIfSingleUser;
- BitField<31, 1, u32> Uknown;
+ BitField<31, 1, u32> Unknown;
};
};
static_assert(sizeof(UserSelectorFlag) == 4, "UserSelectorFlag is an invalid size");
diff --git a/src/core/hle/service/set/system_settings_server.cpp b/src/core/hle/service/set/system_settings_server.cpp
index 122b915c5..87242ae68 100644
--- a/src/core/hle/service/set/system_settings_server.cpp
+++ b/src/core/hle/service/set/system_settings_server.cpp
@@ -97,8 +97,8 @@ ISystemSettingsServer::ISystemSettingsServer(Core::System& system_)
{3, &ISystemSettingsServer::GetFirmwareVersion, "GetFirmwareVersion"},
{4, &ISystemSettingsServer::GetFirmwareVersion2, "GetFirmwareVersion2"},
{5, nullptr, "GetFirmwareVersionDigest"},
- {7, nullptr, "GetLockScreenFlag"},
- {8, nullptr, "SetLockScreenFlag"},
+ {7, &ISystemSettingsServer::GetLockScreenFlag, "GetLockScreenFlag"},
+ {8, &ISystemSettingsServer::SetLockScreenFlag, "SetLockScreenFlag"},
{9, nullptr, "GetBacklightSettings"},
{10, nullptr, "SetBacklightSettings"},
{11, nullptr, "SetBluetoothDevicesSettings"},
@@ -157,12 +157,12 @@ ISystemSettingsServer::ISystemSettingsServer(Core::System& system_)
{66, nullptr, "SetUsb30EnableFlag"},
{67, nullptr, "GetBatteryLot"},
{68, nullptr, "GetSerialNumber"},
- {69, nullptr, "GetNfcEnableFlag"},
- {70, nullptr, "SetNfcEnableFlag"},
+ {69, &ISystemSettingsServer::GetNfcEnableFlag, "GetNfcEnableFlag"},
+ {70, &ISystemSettingsServer::SetNfcEnableFlag, "SetNfcEnableFlag"},
{71, &ISystemSettingsServer::GetSleepSettings, "GetSleepSettings"},
{72, &ISystemSettingsServer::SetSleepSettings, "SetSleepSettings"},
- {73, nullptr, "GetWirelessLanEnableFlag"},
- {74, nullptr, "SetWirelessLanEnableFlag"},
+ {73, &ISystemSettingsServer::GetWirelessLanEnableFlag, "GetWirelessLanEnableFlag"},
+ {74, &ISystemSettingsServer::SetWirelessLanEnableFlag, "SetWirelessLanEnableFlag"},
{75, &ISystemSettingsServer::GetInitialLaunchSettings, "GetInitialLaunchSettings"},
{76, &ISystemSettingsServer::SetInitialLaunchSettings, "SetInitialLaunchSettings"},
{77, &ISystemSettingsServer::GetDeviceNickName, "GetDeviceNickName"},
@@ -176,8 +176,8 @@ ISystemSettingsServer::ISystemSettingsServer(Core::System& system_)
{85, nullptr, "SetPtmBatteryLot"},
{86, nullptr, "GetPtmFuelGaugeParameter"},
{87, nullptr, "SetPtmFuelGaugeParameter"},
- {88, nullptr, "GetBluetoothEnableFlag"},
- {89, nullptr, "SetBluetoothEnableFlag"},
+ {88, &ISystemSettingsServer::GetBluetoothEnableFlag, "GetBluetoothEnableFlag"},
+ {89, &ISystemSettingsServer::SetBluetoothEnableFlag, "SetBluetoothEnableFlag"},
{90, &ISystemSettingsServer::GetMiiAuthorId, "GetMiiAuthorId"},
{91, nullptr, "SetShutdownRtcValue"},
{92, nullptr, "GetShutdownRtcValue"},
@@ -510,6 +510,25 @@ void ISystemSettingsServer::SetUserSystemClockContext(HLERequestContext& ctx) {
rb.Push(res);
}
+void ISystemSettingsServer::GetLockScreenFlag(HLERequestContext& ctx) {
+ LOG_INFO(Service_SET, "called, lock_screen_flag={}", m_system_settings.lock_screen_flag);
+
+ IPC::ResponseBuilder rb{ctx, 3};
+ rb.Push(ResultSuccess);
+ rb.Push(m_system_settings.lock_screen_flag);
+}
+
+void ISystemSettingsServer::SetLockScreenFlag(HLERequestContext& ctx) {
+ IPC::RequestParser rp{ctx};
+ m_system_settings.lock_screen_flag = rp.Pop<bool>();
+ SetSaveNeeded();
+
+ LOG_INFO(Service_SET, "called, lock_screen_flag={}", m_system_settings.lock_screen_flag);
+
+ IPC::ResponseBuilder rb{ctx, 2};
+ rb.Push(ResultSuccess);
+}
+
void ISystemSettingsServer::GetAccountSettings(HLERequestContext& ctx) {
LOG_INFO(Service_SET, "called");
@@ -531,7 +550,7 @@ void ISystemSettingsServer::SetAccountSettings(HLERequestContext& ctx) {
}
void ISystemSettingsServer::GetEulaVersions(HLERequestContext& ctx) {
- LOG_INFO(Service_SET, "called");
+ LOG_INFO(Service_SET, "called, elements={}", m_system_settings.eula_version_count);
ctx.WriteBuffer(m_system_settings.eula_versions);
@@ -557,7 +576,7 @@ void ISystemSettingsServer::SetEulaVersions(HLERequestContext& ctx) {
}
void ISystemSettingsServer::GetColorSetId(HLERequestContext& ctx) {
- LOG_DEBUG(Service_SET, "called");
+ LOG_DEBUG(Service_SET, "called, color_set=", m_system_settings.color_set_id);
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
@@ -576,7 +595,13 @@ void ISystemSettingsServer::SetColorSetId(HLERequestContext& ctx) {
}
void ISystemSettingsServer::GetNotificationSettings(HLERequestContext& ctx) {
- LOG_INFO(Service_SET, "called");
+ LOG_INFO(Service_SET, "called, flags={}, volume={}, head_time={}:{}, tailt_time={}:{}",
+ m_system_settings.notification_settings.flags.raw,
+ m_system_settings.notification_settings.volume,
+ m_system_settings.notification_settings.start_time.hour,
+ m_system_settings.notification_settings.start_time.minute,
+ m_system_settings.notification_settings.stop_time.hour,
+ m_system_settings.notification_settings.stop_time.minute);
IPC::ResponseBuilder rb{ctx, 8};
rb.Push(ResultSuccess);
@@ -601,7 +626,8 @@ void ISystemSettingsServer::SetNotificationSettings(HLERequestContext& ctx) {
}
void ISystemSettingsServer::GetAccountNotificationSettings(HLERequestContext& ctx) {
- LOG_INFO(Service_SET, "called");
+ LOG_INFO(Service_SET, "called, elements={}",
+ m_system_settings.account_notification_settings_count);
ctx.WriteBuffer(m_system_settings.account_notification_settings);
@@ -645,6 +671,7 @@ using Settings =
static Settings GetSettings() {
Settings ret;
+ // AM
ret["hbloader"]["applet_heap_size"] = ToBytes(u64{0x0});
ret["hbloader"]["applet_heap_reservation_size"] = ToBytes(u64{0x8600000});
@@ -656,6 +683,24 @@ static Settings GetSettings() {
ret["time"]["standard_steady_clock_test_offset_minutes"] = ToBytes(s32{0});
ret["time"]["standard_user_clock_initial_year"] = ToBytes(s32{2023});
+ // HID
+ ret["hid_debug"]["enables_debugpad"] = ToBytes(bool{true});
+ ret["hid_debug"]["manages_devices"] = ToBytes(bool{true});
+ ret["hid_debug"]["manages_touch_ic_i2c"] = ToBytes(bool{true});
+ ret["hid_debug"]["emulate_future_device"] = ToBytes(bool{false});
+ ret["hid_debug"]["emulate_mcu_hardware_error"] = ToBytes(bool{false});
+ ret["hid_debug"]["enables_rail"] = ToBytes(bool{true});
+ ret["hid_debug"]["emulate_firmware_update_failure"] = ToBytes(bool{false});
+ ret["hid_debug"]["failure_firmware_update"] = ToBytes(s32{0});
+ ret["hid_debug"]["ble_disabled"] = ToBytes(bool{false});
+ ret["hid_debug"]["dscale_disabled"] = ToBytes(bool{false});
+ ret["hid_debug"]["force_handheld"] = ToBytes(bool{true});
+ ret["hid_debug"]["disabled_features_per_id"] = std::vector<u8>(0xa8);
+ ret["hid_debug"]["touch_firmware_auto_update_disabled"] = ToBytes(bool{false});
+
+ // Settings
+ ret["settings_debug"]["is_debug_mode_enabled"] = ToBytes(bool{false});
+
return ret;
}
@@ -708,7 +753,15 @@ void ISystemSettingsServer::GetSettingsItemValue(HLERequestContext& ctx) {
}
void ISystemSettingsServer::GetTvSettings(HLERequestContext& ctx) {
- LOG_INFO(Service_SET, "called");
+ LOG_INFO(Service_SET,
+ "called, flags={}, cmu_mode={}, contrast_ratio={}, hdmi_content_type={}, "
+ "rgb_range={}, tv_gama={}, tv_resolution={}, tv_underscan={}",
+ m_system_settings.tv_settings.flags.raw, m_system_settings.tv_settings.cmu_mode,
+ m_system_settings.tv_settings.contrast_ratio,
+ m_system_settings.tv_settings.hdmi_content_type,
+ m_system_settings.tv_settings.rgb_range, m_system_settings.tv_settings.tv_gama,
+ m_system_settings.tv_settings.tv_resolution,
+ m_system_settings.tv_settings.tv_underscan);
IPC::ResponseBuilder rb{ctx, 10};
rb.Push(ResultSuccess);
@@ -735,23 +788,26 @@ void ISystemSettingsServer::SetTvSettings(HLERequestContext& ctx) {
}
void ISystemSettingsServer::GetDebugModeFlag(HLERequestContext& ctx) {
- LOG_DEBUG(Service_SET, "called");
+ bool is_debug_mode_enabled = false;
+ GetSettingsItemValue<bool>(is_debug_mode_enabled, "settings_debug", "is_debug_mode_enabled");
+
+ LOG_DEBUG(Service_SET, "called, is_debug_mode_enabled={}", is_debug_mode_enabled);
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
- rb.Push<u32>(0);
+ rb.Push(is_debug_mode_enabled);
}
void ISystemSettingsServer::GetQuestFlag(HLERequestContext& ctx) {
- LOG_WARNING(Service_SET, "(STUBBED) called");
+ LOG_INFO(Service_SET, "called, quest_flag={}", m_system_settings.quest_flag);
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
- rb.PushEnum(QuestFlag::Retail);
+ rb.PushEnum(m_system_settings.quest_flag);
}
void ISystemSettingsServer::GetDeviceTimeZoneLocationName(HLERequestContext& ctx) {
- LOG_WARNING(Service_SET, "called");
+ LOG_INFO(Service_SET, "called");
Service::Time::TimeZone::LocationName name{};
auto res = GetDeviceTimeZoneLocationName(name);
@@ -762,7 +818,7 @@ void ISystemSettingsServer::GetDeviceTimeZoneLocationName(HLERequestContext& ctx
}
void ISystemSettingsServer::SetDeviceTimeZoneLocationName(HLERequestContext& ctx) {
- LOG_WARNING(Service_SET, "called");
+ LOG_INFO(Service_SET, "called");
IPC::RequestParser rp{ctx};
auto name{rp.PopRaw<Service::Time::TimeZone::LocationName>()};
@@ -832,15 +888,38 @@ void ISystemSettingsServer::SetUserSystemClockAutomaticCorrectionEnabled(HLERequ
}
void ISystemSettingsServer::GetPrimaryAlbumStorage(HLERequestContext& ctx) {
- LOG_WARNING(Service_SET, "(STUBBED) called");
+ LOG_INFO(Service_SET, "called, primary_album_storage={}",
+ m_system_settings.primary_album_storage);
+
+ IPC::ResponseBuilder rb{ctx, 3};
+ rb.Push(ResultSuccess);
+ rb.PushEnum(m_system_settings.primary_album_storage);
+}
+
+void ISystemSettingsServer::GetNfcEnableFlag(HLERequestContext& ctx) {
+ LOG_INFO(Service_SET, "called, nfc_enable_flag={}", m_system_settings.nfc_enable_flag);
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
- rb.PushEnum(PrimaryAlbumStorage::SdCard);
+ rb.Push<u8>(m_system_settings.nfc_enable_flag);
+}
+
+void ISystemSettingsServer::SetNfcEnableFlag(HLERequestContext& ctx) {
+ IPC::RequestParser rp{ctx};
+ m_system_settings.nfc_enable_flag = rp.Pop<bool>();
+ SetSaveNeeded();
+
+ LOG_INFO(Service_SET, "called, nfc_enable_flag={}", m_system_settings.nfc_enable_flag);
+
+ IPC::ResponseBuilder rb{ctx, 2};
+ rb.Push(ResultSuccess);
}
void ISystemSettingsServer::GetSleepSettings(HLERequestContext& ctx) {
- LOG_INFO(Service_SET, "called");
+ LOG_INFO(Service_SET, "called, flags={}, handheld_sleep_plan={}, console_sleep_plan={}",
+ m_system_settings.sleep_settings.flags.raw,
+ m_system_settings.sleep_settings.handheld_sleep_plan,
+ m_system_settings.sleep_settings.console_sleep_plan);
IPC::ResponseBuilder rb{ctx, 5};
rb.Push(ResultSuccess);
@@ -861,8 +940,32 @@ void ISystemSettingsServer::SetSleepSettings(HLERequestContext& ctx) {
rb.Push(ResultSuccess);
}
+void ISystemSettingsServer::GetWirelessLanEnableFlag(HLERequestContext& ctx) {
+ LOG_INFO(Service_SET, "called, wireless_lan_enable_flag={}",
+ m_system_settings.wireless_lan_enable_flag);
+
+ IPC::ResponseBuilder rb{ctx, 3};
+ rb.Push(ResultSuccess);
+ rb.Push(m_system_settings.wireless_lan_enable_flag);
+}
+
+void ISystemSettingsServer::SetWirelessLanEnableFlag(HLERequestContext& ctx) {
+ IPC::RequestParser rp{ctx};
+ m_system_settings.wireless_lan_enable_flag = rp.Pop<bool>();
+ SetSaveNeeded();
+
+ LOG_INFO(Service_SET, "called, wireless_lan_enable_flag={}",
+ m_system_settings.wireless_lan_enable_flag);
+
+ IPC::ResponseBuilder rb{ctx, 2};
+ rb.Push(ResultSuccess);
+}
+
void ISystemSettingsServer::GetInitialLaunchSettings(HLERequestContext& ctx) {
- LOG_INFO(Service_SET, "called");
+ LOG_INFO(Service_SET, "called, flags={}, timestamp={}",
+ m_system_settings.initial_launch_settings_packed.flags.raw,
+ m_system_settings.initial_launch_settings_packed.timestamp.time_point);
+
IPC::ResponseBuilder rb{ctx, 10};
rb.Push(ResultSuccess);
rb.PushRaw(m_system_settings.initial_launch_settings_packed);
@@ -913,35 +1016,51 @@ void ISystemSettingsServer::GetProductModel(HLERequestContext& ctx) {
rb.Push(product_model);
}
-void ISystemSettingsServer::GetMiiAuthorId(HLERequestContext& ctx) {
- const auto author_id = Common::UUID::MakeDefault();
+void ISystemSettingsServer::GetBluetoothEnableFlag(HLERequestContext& ctx) {
+ LOG_INFO(Service_SET, "called, bluetooth_enable_flag={}",
+ m_system_settings.bluetooth_enable_flag);
- LOG_WARNING(Service_SET, "(STUBBED) called, author_id={}", author_id.FormattedString());
+ IPC::ResponseBuilder rb{ctx, 3};
+ rb.Push(ResultSuccess);
+ rb.Push<u8>(m_system_settings.bluetooth_enable_flag);
+}
+
+void ISystemSettingsServer::SetBluetoothEnableFlag(HLERequestContext& ctx) {
+ IPC::RequestParser rp{ctx};
+ m_system_settings.bluetooth_enable_flag = rp.Pop<bool>();
+ SetSaveNeeded();
+
+ LOG_INFO(Service_SET, "called, bluetooth_enable_flag={}",
+ m_system_settings.bluetooth_enable_flag);
+
+ IPC::ResponseBuilder rb{ctx, 2};
+ rb.Push(ResultSuccess);
+}
+
+void ISystemSettingsServer::GetMiiAuthorId(HLERequestContext& ctx) {
+ LOG_INFO(Service_SET, "called, author_id={}",
+ m_system_settings.mii_author_id.FormattedString());
IPC::ResponseBuilder rb{ctx, 6};
rb.Push(ResultSuccess);
- rb.PushRaw(author_id);
+ rb.PushRaw(m_system_settings.mii_author_id);
}
void ISystemSettingsServer::GetAutoUpdateEnableFlag(HLERequestContext& ctx) {
- u8 auto_update_flag{};
-
- LOG_WARNING(Service_SET, "(STUBBED) called, auto_update_flag={}", auto_update_flag);
+ LOG_INFO(Service_SET, "called, auto_update_flag={}", m_system_settings.auto_update_enable_flag);
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
- rb.Push(auto_update_flag);
+ rb.Push(m_system_settings.auto_update_enable_flag);
}
void ISystemSettingsServer::GetBatteryPercentageFlag(HLERequestContext& ctx) {
- u8 battery_percentage_flag{1};
-
- LOG_WARNING(Service_SET, "(STUBBED) called, battery_percentage_flag={}",
- battery_percentage_flag);
+ LOG_DEBUG(Service_SET, "called, battery_percentage_flag={}",
+ m_system_settings.battery_percentage_flag);
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
- rb.Push(battery_percentage_flag);
+ rb.Push(m_system_settings.battery_percentage_flag);
}
void ISystemSettingsServer::SetExternalSteadyClockInternalOffset(HLERequestContext& ctx) {
@@ -968,11 +1087,12 @@ void ISystemSettingsServer::GetExternalSteadyClockInternalOffset(HLERequestConte
}
void ISystemSettingsServer::GetErrorReportSharePermission(HLERequestContext& ctx) {
- LOG_WARNING(Service_SET, "(STUBBED) called");
+ LOG_INFO(Service_SET, "called, error_report_share_permission={}",
+ m_system_settings.error_report_share_permission);
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
- rb.PushEnum(ErrorReportSharePermission::Denied);
+ rb.PushEnum(m_system_settings.error_report_share_permission);
}
void ISystemSettingsServer::GetAppletLaunchFlags(HLERequestContext& ctx) {
@@ -1014,7 +1134,7 @@ void ISystemSettingsServer::GetKeyboardLayout(HLERequestContext& ctx) {
}
void ISystemSettingsServer::GetDeviceTimeZoneLocationUpdatedTime(HLERequestContext& ctx) {
- LOG_WARNING(Service_SET, "called.");
+ LOG_INFO(Service_SET, "called");
Service::Time::Clock::SteadyClockTimePoint time_point{};
auto res = GetDeviceTimeZoneLocationUpdatedTime(time_point);
@@ -1025,7 +1145,7 @@ void ISystemSettingsServer::GetDeviceTimeZoneLocationUpdatedTime(HLERequestConte
}
void ISystemSettingsServer::SetDeviceTimeZoneLocationUpdatedTime(HLERequestContext& ctx) {
- LOG_WARNING(Service_SET, "called.");
+ LOG_INFO(Service_SET, "called");
IPC::RequestParser rp{ctx};
auto time_point{rp.PopRaw<Service::Time::Clock::SteadyClockTimePoint>()};
@@ -1038,7 +1158,7 @@ void ISystemSettingsServer::SetDeviceTimeZoneLocationUpdatedTime(HLERequestConte
void ISystemSettingsServer::GetUserSystemClockAutomaticCorrectionUpdatedTime(
HLERequestContext& ctx) {
- LOG_WARNING(Service_SET, "called.");
+ LOG_INFO(Service_SET, "called");
Service::Time::Clock::SteadyClockTimePoint time_point{};
auto res = GetUserSystemClockAutomaticCorrectionUpdatedTime(time_point);
@@ -1050,7 +1170,7 @@ void ISystemSettingsServer::GetUserSystemClockAutomaticCorrectionUpdatedTime(
void ISystemSettingsServer::SetUserSystemClockAutomaticCorrectionUpdatedTime(
HLERequestContext& ctx) {
- LOG_WARNING(Service_SET, "called.");
+ LOG_INFO(Service_SET, "called");
IPC::RequestParser rp{ctx};
auto time_point{rp.PopRaw<Service::Time::Clock::SteadyClockTimePoint>()};
@@ -1062,11 +1182,12 @@ void ISystemSettingsServer::SetUserSystemClockAutomaticCorrectionUpdatedTime(
}
void ISystemSettingsServer::GetChineseTraditionalInputMethod(HLERequestContext& ctx) {
- LOG_WARNING(Service_SET, "(STUBBED) called");
+ LOG_INFO(Service_SET, "called, chinese_traditional_input_method={}",
+ m_system_settings.chinese_traditional_input_method);
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
- rb.PushEnum(ChineseTraditionalInputMethod::Unknown0);
+ rb.PushEnum(m_system_settings.chinese_traditional_input_method);
}
void ISystemSettingsServer::GetHomeMenuScheme(HLERequestContext& ctx) {
@@ -1094,11 +1215,11 @@ void ISystemSettingsServer::GetHomeMenuSchemeModel(HLERequestContext& ctx) {
}
void ISystemSettingsServer::GetFieldTestingFlag(HLERequestContext& ctx) {
- LOG_WARNING(Service_SET, "(STUBBED) called");
+ LOG_INFO(Service_SET, "called, field_testing_flag={}", m_system_settings.field_testing_flag);
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
- rb.Push<u8>(false);
+ rb.Push(m_system_settings.field_testing_flag);
}
void ISystemSettingsServer::SetupSettings() {
diff --git a/src/core/hle/service/set/system_settings_server.h b/src/core/hle/service/set/system_settings_server.h
index bab913615..32716f567 100644
--- a/src/core/hle/service/set/system_settings_server.h
+++ b/src/core/hle/service/set/system_settings_server.h
@@ -37,6 +37,18 @@ public:
Result GetSettingsItemValue(std::vector<u8>& out_value, const std::string& category,
const std::string& name);
+ template <typename T>
+ Result GetSettingsItemValue(T& value, const std::string& category, const std::string& name) {
+ std::vector<u8> data;
+ const auto result = GetSettingsItemValue(data, category, name);
+ if (result.IsError()) {
+ return result;
+ }
+ ASSERT(data.size() >= sizeof(T));
+ std::memcpy(&value, data.data(), sizeof(T));
+ return result;
+ }
+
Result GetExternalSteadyClockSourceId(Common::UUID& out_id);
Result SetExternalSteadyClockSourceId(Common::UUID id);
Result GetUserSystemClockContext(Service::Time::Clock::SystemClockContext& out_context);
@@ -62,6 +74,8 @@ private:
void SetLanguageCode(HLERequestContext& ctx);
void GetFirmwareVersion(HLERequestContext& ctx);
void GetFirmwareVersion2(HLERequestContext& ctx);
+ void GetLockScreenFlag(HLERequestContext& ctx);
+ void SetLockScreenFlag(HLERequestContext& ctx);
void GetExternalSteadyClockSourceId(HLERequestContext& ctx);
void SetExternalSteadyClockSourceId(HLERequestContext& ctx);
void GetUserSystemClockContext(HLERequestContext& ctx);
@@ -90,13 +104,19 @@ private:
void IsUserSystemClockAutomaticCorrectionEnabled(HLERequestContext& ctx);
void SetUserSystemClockAutomaticCorrectionEnabled(HLERequestContext& ctx);
void GetPrimaryAlbumStorage(HLERequestContext& ctx);
+ void GetNfcEnableFlag(HLERequestContext& ctx);
+ void SetNfcEnableFlag(HLERequestContext& ctx);
void GetSleepSettings(HLERequestContext& ctx);
void SetSleepSettings(HLERequestContext& ctx);
+ void GetWirelessLanEnableFlag(HLERequestContext& ctx);
+ void SetWirelessLanEnableFlag(HLERequestContext& ctx);
void GetInitialLaunchSettings(HLERequestContext& ctx);
void SetInitialLaunchSettings(HLERequestContext& ctx);
void GetDeviceNickName(HLERequestContext& ctx);
void SetDeviceNickName(HLERequestContext& ctx);
void GetProductModel(HLERequestContext& ctx);
+ void GetBluetoothEnableFlag(HLERequestContext& ctx);
+ void SetBluetoothEnableFlag(HLERequestContext& ctx);
void GetMiiAuthorId(HLERequestContext& ctx);
void GetAutoUpdateEnableFlag(HLERequestContext& ctx);
void GetBatteryPercentageFlag(HLERequestContext& ctx);
diff --git a/src/hid_core/resources/hid_firmware_settings.cpp b/src/hid_core/resources/hid_firmware_settings.cpp
index 9fa0db17e..00ceff7e6 100644
--- a/src/hid_core/resources/hid_firmware_settings.cpp
+++ b/src/hid_core/resources/hid_firmware_settings.cpp
@@ -1,11 +1,14 @@
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
+#include "core/hle/service/set/system_settings_server.h"
+#include "core/hle/service/sm/sm.h"
#include "hid_core/resources/hid_firmware_settings.h"
namespace Service::HID {
-HidFirmwareSettings::HidFirmwareSettings() {
+HidFirmwareSettings::HidFirmwareSettings(Core::System& system) {
+ m_set_sys = system.ServiceManager().GetService<Service::Set::ISystemSettingsServer>("set:sys");
LoadSettings(true);
}
@@ -18,21 +21,25 @@ void HidFirmwareSettings::LoadSettings(bool reload_config) {
return;
}
- // TODO: Use nn::settings::fwdbg::GetSettingsItemValue to load config values
-
- is_debug_pad_enabled = true;
- is_device_managed = true;
- is_touch_i2c_managed = is_device_managed;
- is_future_devices_emulated = false;
- is_mcu_hardware_error_emulated = false;
- is_rail_enabled = true;
- is_firmware_update_failure_emulated = false;
+ m_set_sys->GetSettingsItemValue<bool>(is_debug_pad_enabled, "hid_debug", "enables_debugpad");
+ m_set_sys->GetSettingsItemValue<bool>(is_device_managed, "hid_debug", "manages_devices");
+ m_set_sys->GetSettingsItemValue<bool>(is_touch_i2c_managed, "hid_debug",
+ "manages_touch_ic_i2c");
+ m_set_sys->GetSettingsItemValue<bool>(is_future_devices_emulated, "hid_debug",
+ "emulate_future_device");
+ m_set_sys->GetSettingsItemValue<bool>(is_mcu_hardware_error_emulated, "hid_debug",
+ "emulate_mcu_hardware_error");
+ m_set_sys->GetSettingsItemValue<bool>(is_rail_enabled, "hid_debug", "enables_rail");
+ m_set_sys->GetSettingsItemValue<bool>(is_firmware_update_failure_emulated, "hid_debug",
+ "emulate_firmware_update_failure");
is_firmware_update_failure = {};
- is_ble_disabled = false;
- is_dscale_disabled = false;
- is_handheld_forced = true;
+ m_set_sys->GetSettingsItemValue<bool>(is_ble_disabled, "hid_debug", "ble_disabled");
+ m_set_sys->GetSettingsItemValue<bool>(is_dscale_disabled, "hid_debug", "dscale_disabled");
+ m_set_sys->GetSettingsItemValue<bool>(is_handheld_forced, "hid_debug", "force_handheld");
features_per_id_disabled = {};
- is_touch_firmware_auto_update_disabled = false;
+ m_set_sys->GetSettingsItemValue<bool>(is_touch_firmware_auto_update_disabled, "hid_debug",
+ "touch_firmware_auto_update_disabled");
+
is_initialized = true;
}
diff --git a/src/hid_core/resources/hid_firmware_settings.h b/src/hid_core/resources/hid_firmware_settings.h
index 00201fd94..3694fa9a3 100644
--- a/src/hid_core/resources/hid_firmware_settings.h
+++ b/src/hid_core/resources/hid_firmware_settings.h
@@ -5,6 +5,14 @@
#include "common/common_types.h"
+namespace Core {
+class System;
+}
+
+namespace Service::Set {
+class ISystemSettingsServer;
+}
+
namespace Service::HID {
/// Loads firmware config from nn::settings::fwdbg
@@ -13,7 +21,7 @@ public:
using FirmwareSetting = std::array<u8, 4>;
using FeaturesPerId = std::array<bool, 0xA8>;
- HidFirmwareSettings();
+ HidFirmwareSettings(Core::System& system);
void Reload();
void LoadSettings(bool reload_config);
@@ -49,6 +57,8 @@ private:
bool is_touch_firmware_auto_update_disabled{};
FirmwareSetting is_firmware_update_failure{};
FeaturesPerId features_per_id_disabled{};
+
+ std::shared_ptr<Service::Set::ISystemSettingsServer> m_set_sys;
};
} // namespace Service::HID